* set your working directory here *

use "selling_data.dta", clear
set more off

* Table 2: Patterns of Support for Enforcement (manually transcribe into LaTeX)
sum punish_statement punish_sanction punish_aid punish_remove redress_pro ///
	if country == 1 & treatment == 1 // USA mean, control only
sum punish_statement_support punish_sanction_support punish_aid_support punish_remove_support redress_pro_support ///
	if country == 1 & treatment == 1 // USA % support, control only
sum punish_statement punish_sanction punish_aid punish_remove redress_pro ///
	if country == 4 & treatment == 1 // AUS mean, control only
sum punish_statement_support punish_sanction_support punish_aid_support punish_remove_support redress_pro_support ///
	if country == 4 & treatment == 1 // AUS % support, control only
	
	
* Figure 1: Average Treatment Effect of Elite Justifications
// United States
reg enforce i.treatment i.treat_level i.treat_countrypro i.treat_propre if country==1, robust
margins, asbalanced dydx(treatment)
#delimit ;
marginsplot, horizontal name(usall, replace) 
	plot1opts(mcolor(black) lcolor(black) connect(none)) 
	ci1opts(recast(rspike) lcolor(black)) 
	graphregion(fcolor(white) lcolor(white)) 
	plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none)) 
	title("", color(black)) 
	subtitle("United States", color(black)) 
	yscale(reverse range(1 4) noline)
	ylabel(0(1)3 0 "Control" 1 "Illegal" 2 "Breakdown" 3 "Both", noticks labsize(medium) glcolor(gs14) angle(horizontal))
	ytitle("", margin(medsmall))
	xline(0, lwidth(vthin) lcolor(black))
	xtitle("Average treatment effect", margin(medsmall))
	xscale(range(-0.3 0.3))
	xlabel(-0.3(.1)0.3,valuelabel labsize(medsmall) glcolor(white) angle(horizontal))
	addplot(scatteri 0 0, mcolor(black) lcolor(black)
		xscale(range(-0.3 0.3))
		xlabel(-0.3(.1)0.3, valuelabel labsize(medsmall) glcolor(white) angle(horizontal)))
	legend(off);
#delimit cr;

// Australia
reg enforce i.treatment i.treat_level i.treat_countrypro i.treat_propre if country==4, robust
margins, asbalanced dydx(treatment)
#delimit ;
marginsplot, horizontal name(ausall, replace) 
	plot1opts(mcolor(black) lcolor(black) connect(none)) 
	ci1opts(recast(rspike) lcolor(black)) 
	graphregion(fcolor(white) lcolor(white)) 
	plotregion(fcolor(white) lstyle(none) lcolor(white) ilstyle(none)) 
	title("", color(black)) 
	subtitle("Australia", color(black)) 
	yscale(reverse range(1 4) noline)
	ylabel(0(1)3 0 "Control" 1 "Illegal" 2 "Breakdown" 3 "Both", noticks labsize(medium) glcolor(gs14) angle(horizontal))
	ytitle("", margin(medsmall))
	xline(0, lwidth(vthin) lcolor(black))
	xtitle("Average treatment effect", margin(medsmall))
	xscale(range(-0.3 0.3))
	xlabel(-0.3(.1)0.3,valuelabel labsize(medsmall) glcolor(white) angle(horizontal))
	addplot(scatteri 0 0, mcolor(black) lcolor(black)
		xscale(range(-0.3 0.3))
		xlabel(-0.3(.1)0.3, valuelabel labsize(medsmall) glcolor(white) angle(horizontal)))
	legend(off);
#delimit cr;

// Combine
graph combine usall ausall, name(combined, replace) xcommon ///
	graphregion(fcolor(white) lwidth(thick) lcolor(white)) row(1) xsize(10)scale(1.75)
graph export "rp_figure_1.png", replace


* Table 3 and Table A2: Individual Correlates of Support for Military and Non-Military Enforcement Actions
eststo clear

eststo mil1: reg index_hard leftright enforcer2 relimp woman age child usa_educ employed_full i.treatment i.treat_countrypro i.treat_level i.treat_propre if country==1, robust
estadd local controls "Yes" 

eststo mil2: reg index_soft leftright enforcer2 relimp woman age child usa_educ employed_full i.treatment i.treat_countrypro i.treat_level i.treat_propre if country==1, robust
estadd local controls "Yes" 

eststo mil3: reg index_hard leftright enforcer2 relimp woman age child aus_educ employed_full i.treatment i.treat_countrypro i.treat_level i.treat_propre if country==4, robust
estadd local controls "Yes" 

eststo mil4: reg index_soft leftright enforcer2 relimp woman age child aus_educ employed_full i.treatment i.treat_countrypro i.treat_level i.treat_propre if country==4, robust
estadd local controls "Yes" 

esttab mil* using "rp_table_3.tex", replace ///
	drop(relimp woman age child usa_educ aus_educ employed_full *.treatment *.treat_countrypro *.treat_level *.treat_propre)  ///
	se star(* 0.10 ** 0.05 *** 0.01) r2 b(%8.2f) se(%8.2f) r2(%8.2f)  ///
	scalars("controls Controls" "controls Controls" "controls Controls" "controls Controls") ///
	mtitle("\shortstack{\textbf{United States}\\Military}" "\shortstack{\textbf{United States}\\Non-Military}" "\shortstack{\textbf{Australia}\\Military}" "\shortstack{\textbf{Australia}\\Non-Military}") ///
	nonotes nonum nogaps ///
	tex label compress 
	
esttab mil* using "rp_table_a2.tex", replace ///
	drop(*.treatment *.treat_countrypro *.treat_level *.treat_propre)  ///
	se star(* 0.10 ** 0.05 *** 0.01) r2 b(%8.2f) se(%8.2f) r2(%8.2f)  ///
	mtitle("\shortstack{\textbf{United States}\\Military}" "\shortstack{\textbf{United States}\\Non-Military}" "\shortstack{\textbf{Australia}\\Military}" "\shortstack{\textbf{Australia}\\Non-Military}") ///
	nonotes nonum nogaps rename(aus_educ usa_educ)  ///
	tex label compress 
	

* Table A3: Individual Correlates of Support for Enforcement Actions
eststo enf_ind_usa: reg enforce leftright enforcer2 relimp woman age child usa_educ employed_full i.treatment i.treat_countrypro i.treat_level i.treat_propre if country==1, robust
eststo enf_ind_aus: reg enforce leftright enforcer2 relimp woman age child aus_educ employed_full i.treatment i.treat_countrypro i.treat_level i.treat_propre if country==4, robust

esttab enf_ind* using "rp_table_a3.tex", replace ///
	drop(*.treatment *.treat_countrypro *.treat_level *.treat_propre)  ///
	se star(* 0.10 ** 0.05 *** 0.01) r2 b(%8.2f) se(%8.2f) r2(%8.2f)  ///
	mtitle("\shortstack{\textbf{United States}\\Military}" "\shortstack{\textbf{United States}\\Non-Military}" "\shortstack{\textbf{Australia}\\Military}" "\shortstack{\textbf{Australia}\\Non-Military}") ///
	nonotes nonum nogaps rename(aus_educ usa_educ)  ///
	tex label compress 
	
	
* Table A4: Interaction Between Ideology and the Illegal Treatment
eststo iii1: reg enforce enforcer2 c.leftright##treat_lawdum treat_breakdum treat_bothdum relimp woman age ///
	child usa_educ employed_full i.treat_countrypro i.treat_level i.treat_propre if country==1, robust
estadd local controls "Yes" 

eststo iii2: reg enforce enforcer2 c.leftright##treat_lawdum treat_breakdum treat_bothdum relimp woman age ///
	child aus_educ employed_full i.treat_countrypro i.treat_level i.treat_propre if country==4, robust
estadd local controls "Yes" 
	
esttab iii* using "rp_table_a4.tex", replace ///
	drop(0.treat* relimp woman age child usa_educ employed_full *.treat_countrypro *.treat_level *.treat_propre )  ///
	se star(* 0.10 ** 0.05 *** 0.01) r2 b(%8.2f) se(%8.2f) r2(%8.2f)  ///
	scalars("controls Controls" "controls Controls") ///
	mtitle("\textbf{United States}" "\textbf{Australia}") ///
	coeflabel(1.treat_lawdum#c.leftright "Ideology*Illegal" ///
		1.treat_lawdum "Illegal Treatment" treat_breakdum "Breakdown Treatment" treat_bothdum "Both Treatments") ///
	nonotes nonum nogaps rename(aus_educ usa_educ)  ///
	tex label compress 
	
	
* Table A5: Interaction Between Ideology and the Breakdown Treatment
eststo iib1: reg enforce enforcer2 c.leftright##treat_breakdum treat_lawdum treat_bothdum relimp woman age ///
	child usa_educ employed_full i.treat_countrypro i.treat_level i.treat_propre if country==1, robust
estadd local controls "Yes" 

eststo iib2: reg enforce enforcer2 c.leftright##treat_breakdum treat_lawdum treat_bothdum relimp woman age ///
	child aus_educ employed_full i.treat_countrypro i.treat_level i.treat_propre if country==4, robust
estadd local controls "Yes" 

esttab iib* using "rp_table_a5.tex", replace ///
	drop(0.treat* relimp woman age child usa_educ employed_full *.treat_countrypro *.treat_level *.treat_propre )  ///
	se star(* 0.10 ** 0.05 *** 0.01) r2 b(%8.2f) se(%8.2f) r2(%8.2f)  ///
	scalars("controls Controls" "controls Controls") ///
	mtitle("\textbf{United States}" "\textbf{Australia}") ///
	coeflabel(1.treat_breakdum#c.leftright "Ideology*Breakdown" ///
		treat_lawdum "Illegal Treatment" 1.treat_breakdum "Breakdown Treatment" treat_bothdum "Both Treatments") ///
	nonotes nonum nogaps rename(aus_educ usa_educ)  ///
	tex label compress 
	

* Table A6: Interaction Between Interpersonal Norm Enforcement and Elite Justifications
eststo iej1: reg enforce enforcer2##i.treatment relimp woman age leftright ///
	child usa_educ employed_full i.treat_countrypro i.treat_level i.treat_propre if country==1, robust
estadd local controls "Yes" 

eststo iej2: reg enforce enforcer2##i.treatment relimp woman age leftright ///
	child aus_educ employed_full i.treat_countrypro i.treat_level i.treat_propre if country==4, robust
estadd local controls "Yes" 

esttab iej* using "rp_table_a6.tex", replace ///
	drop(0.enforcer2* 1.treatment 1.enforcer2#1.treatment relimp woman age child usa_educ employed_full *.treat_countrypro *.treat_level *.treat_propre )  ///
	se star(* 0.10 ** 0.05 *** 0.01) r2 b(%8.2f) se(%8.2f) r2(%8.2f)  ///
	scalars("controls Controls" "controls Controls") ///
	mtitle("\textbf{United States}" "\textbf{Australia}") ///
	coeflabel(1.enforcer2 "Interpersonal" ///
		2.treatment "Illegal Treatment" 3.treatment "Breakdown Treatment" 4.treatment "Both Treatments" ///
		1.enforcer2#2.treatment "Interpersonal*Illegal" 1.enforcer2#3.treatment "Interpersonal*Breakdown" ///
		1.enforcer2#4.treatment "Interpersonal*Both") ///
	nonotes nonum nogaps rename(aus_educ usa_educ)  ///
	tex label compress 
	
